package cn.iocoder.yudao.module.trade.controller.admin.oderreminder.vo;

import cn.iocoder.yudao.framework.common.util.DateUtil;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.io.Serializable;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.*;

import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

import com.alibaba.excel.annotation.*;

@Schema(description = "管理后台 - 催单 Response VO")
@Data
@ExcelIgnoreUnannotated
public class OderReminderRespVO extends BaseDO implements Serializable {

    @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32422")
    @ExcelProperty("id")
    private Long id;

    @Schema(description = "用户id", example = "4470")
    @ExcelProperty("用户id")
    private Long memberUserId;

    @Schema(description = "订单状态", example = "2")
    @ExcelProperty("订单状态")
    private Integer orderStatus;

    @Schema(description = "被催单人")
    @ExcelProperty("被催单人")
    private Long reminderedPerson;

    @Schema(description = "机构类型", example = "2")
    @ExcelProperty("机构类型")
    private Integer deptType;

    @Schema(description = "机构id", example = "1739")
    @ExcelProperty("机构id")
    private Long reminderedDeptId;

    @Schema(description = "创建时间")
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    @Schema(description = "订单id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31546")
    @ExcelProperty("订单id")
    private String orderId;

    @Schema(description = "0：手动催单 1：自动催单", example = "2")
    @ExcelProperty("0：手动催单 1：自动催单")
    private Integer type;

    @Schema(description = "催单原因:立即送达;半小时内送达;一小时内送达等等", example = "一小时内送达")
    @ExcelProperty("催单原因")
    private String reason;

    @Schema(description = "操作人", example = "管理员")
    @ExcelProperty("操作人")
    private String username;

    @Schema(description = "催单类型:0：立即送达;1：半小时内送达;2：一小时内送达 3：其他", example = "3")
    private Integer reminderType;


    public Boolean getIfTryReminder() {
        ZonedDateTime dateTime = this.getCreateTime().atZone(ZoneId.systemDefault());
        if (Date.from(dateTime.toInstant()).compareTo(DateUtil.getCurrUpMinuteDate(60)) > 0) {
            return false;
        }
        return true;
    }
}